1. Field of the Invention
The present invention relates to compilation of computer program code, and more particularly to compilation which reduces the number of exception checks.
2. Description of the Related Art
Computer software comprises a set of instructions to be executed by a data processing system. Generally, computer software makes a data processing system useful, by providing the instructions for the data processing system to carry out productive tasks. Computer software provides instructions that enable a data processing system to function as, for example, a word processing device, spreadsheet device, or an Internet browsing device.
A wide variety of different data processing systems are capable of using computer software. Accordingly, as used herein, the term “data processing system” is intended to have a broad meaning, and may include personal computers, laptop computers, palmtop computers, handheld computers, network computers, servers, mainframes, workstations, cellular telephones and similar wireless devices, personal digital assistants and other electronic devices on which computer software may be installed. The terms “computer”, “computer software”, “computer program”, “computer programming”, “software”, “software program” and related terms are intended to have a similarly broad meaning.
Generally, modern computer software is originally written in a computer programming language using syntactic constructs that are comprehensible by a programmer. The computer programming language represents the instructions embodied in the software. For example, in the “C” programming language, the syntactic term “print” is used to represent an instruction to the data processing system to print the contents of a particular data field.
These types of computer programming languages are useful because their syntactic constructs increase the ease with which programmers can create computer software, since the programmers do not need to compose instructions in a language that would be directly understood by the data processing system. Writing instructions in such a language would be far more difficult because such languages bear little or no resemblance to any human language.
A computer program, or a portion thereof, written with such a human-comprehensible programming language is generally referred to as “source code”. Software developers can create source code either by directly authoring the source code (for example by entering the instructions into a text editor), or, more recently, by using specialized software programs that provide a specially designed user interface and that partially or substantially automate the generation of source code.
Instructions written in human-comprehensible source code, however, generally cannot be directly understood and implemented by a data processing system. Therefore, before a computer program written in human-comprehensible computer programming language (i.e. source code) may be used by a data processing system, the source code must first be “compiled” into language that will be understood by the target data processing system.
Compiling is a process, usually carried out by a computer program called a “compiler”, in which a computer program (or a portion thereof) in an input computer language is transformed into compiled code, which may be in the same or a different computer language. In one exemplary compiling process, syntactic constructs of a human-comprehensible computer programming language are translated into instructions in a language that will be understood by the target data processing system (possibly through an intermediate software layer). In this example, the result of the “compiling” or “compilation” process is known as “executable code.” Executable code is computer program code that can be executed by the data processing system either directly or by an intermediate software layer. Executable code is generally platform-specific, meaning that it can only be executed by a specific type of computer system. Accordingly, source code must generally be compiled in a specific way to be executed by a given type of computer.
Usually, a direct translation of a computer program written in a high level computer programming language into executable code will not result in particularly efficient executable code. There may be, for example, redundant operations, inefficient allocations of memory within the data processing system, and other circumstances which would impair the efficiency of the executable code. In addition, the order of instructions specified by the human programmer may not be the most efficient, or even nearly the most efficient, way to carry out the instructions on the data processing system.
To obviate these difficulties, various performance improvement algorithms are applied when compiling computer programs written in a high level computer programming language. The application of such performance improvement algorithms is referred to as “optimizing” or “optimization”. As used herein, the terms “optimizing”, “optimization”, and related terms do not imply some form of actually optimal code in the sense that further improvement is not possible; rather, these terms mean that some form of performance improvement algorithm has been applied to the relevant code, even if further improvement is still possible.
For certain computer programming languages, such as Java™, the source code is first compiled into an intermediate form that can be implemented by an intermediate software layer, such as a Java virtual machine (hereinafter “JVM”). In Java, this intermediate form is known as “bytecode”. (Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.) Typically, but not necessarily, the intermediate software layer will carry out additional compilation each time the computer program is run, usually to translate the intermediate form of the source code into executable code that can be directly executed by the data processing system. While the JVM itself is platform-specific, it enables any computer having a compatible JVM to execute a Java program that has been compiled into bytecode, without the Java program having to have been compiled in a platform-specific manner.